package com.fanshuai.tree.quadtree;

/**
 * 有序点  按距离排序
 */
public class SortedPoint implements Comparable<SortedPoint> {
    public Point point; //点
    public double dist; //距离

    public SortedPoint(Point point, double dist) {
        this.point = point;
        this.dist = dist;
    }

    @Override
    public int compareTo(SortedPoint o) {
        if (null == o) {
            return -1;
        }

        return Double.compare(dist, o.dist);
    }

    @Override
    public String toString() {
        return point + " - " + dist;
    }
}
